xsplice,symbols: Implement symbol name resolution on address.
authorRoss Lagerwall <ross.lagerwall@citrix.com>
Wed, 20 Apr 2016 20:19:27 +0000 (16:19 -0400)
committerKonrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Fri, 29 Apr 2016 07:58:36 +0000 (03:58 -0400)
commitdeed149b1b39f8295f24de8706e95cfcd15408ee
tree55a85e193ef318b85f77b352b5e629dcdc5b0c61
parentffcd7c069881219d4e60f3e5d7f12f1df44c9353
xsplice,symbols: Implement symbol name resolution on address.

If in the payload we do not have the old_addr we can resolve
the virtual address based on the UNDEFined symbols.

We also use an boolean flag: new_symbol to track symbols. The usual
case this is used is by:

* A payload may introduce a new symbol
* A payload may override an existing symbol (introduced in Xen or another
  payload)
* Overriding symbols must exist in the symtab for backtraces.
* A payload must always link against the object which defines the new symbol.

Considering that payloads may be loaded in any order it would be incorrect to
link against a payload which simply overrides a symbol because you could end
up with a chain of jumps which is inefficient and may result in the expected
function not being executed.

Since the payload we get is an relocatable image (partial linked ELF file)
we have to match up the symbols. We follow the ELF visibility rules for that
and for local symbols do what bintutils ld does.

Signed-off-by: Konrad Rzeszutek Wilk <konrad.wilk@oracle.com>
Signed-off-by: Ross Lagerwall <ross.lagerwall@citrix.com>
Reviewed-by: Andrew Cooper <andrew.cooper3@citrix.com>
Acked-by: Jan Beulich <jbeulich@suse.com>
Release-acked-by: Wei Liu <wei.liu2@citrix.com>
xen/arch/x86/Makefile
xen/arch/x86/platform_hypercall.c
xen/arch/x86/test/Makefile
xen/arch/x86/test/xen_hello_world.c
xen/common/symbols.c
xen/common/xsplice.c
xen/common/xsplice_elf.c
xen/include/xen/elfstructs.h
xen/include/xen/symbols.h
xen/include/xen/xsplice.h